package com.gohome.gohomechat.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.gohome.gohomechat.GoHomeModel;
import com.gohome.gohomechat.model.entify.Contant;

/**
 * Created by dllo on 16/3/4.
 */
public class DBOpenHelper extends SQLiteOpenHelper {
    private String sql_friend = "create table if not exists " + Contant.TABLE_FRIEND + " (msgId integer primary key autoincrement, head text, username text,pinyin text)";
    private String sql_notice = "create table if not exists " + Contant.TABLE_NOTICE + " (msgId integer primary key autoincrement, head text, username text,reason text," +
            "time integer, messagestatus integer, groupid text, groupname text)";
    private String sql_personal= "create table if not exists " + Contant.TABLE_PERSONAL + " (msgId integer primary key autoincrement, nick text,singnature text,birthday text,sex text,age text,zodiaz text," +
            "boold text,email text,head text,username text)";

    public DBOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(sql_friend);
        db.execSQL(sql_notice);
        db.execSQL(sql_personal);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
